<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateAkbusAccidentTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('akbus_accident', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('number')->nullable()->comment('单号');
            $table->string('case_number')->nullable()->comment('案号');
            // 司机部分
            $table->date('date')->nullable()->comment('事故日期');
            $table->string('license_plate_num')->nullable()->comment('车辆车牌号');
            $table->integer('user_id')->nullable()->comment('驾驶员，保存驾驶员的用户id');
            $table->string('user_name')->nullable()->comment('驾驶员，保存驾驶员名字');
            $table->string('accident_info', 500)->nullable()->comment('事故详情');
            $table->text('accident_file')->nullable()->comment('事故照片');
            // 事故处理部-事故处理
            $table->integer('receiver_id')->nullable()->comment('接案人');
            $table->string('violation')->nullable()->comment('违规处理');
            $table->string('nature')->nullable()->comment('事故性质');
            $table->string('responsible')->nullable()->comment('事故责任认定');
            // 事故处理部-事故费用
            $table->decimal('car_damage', 10, 2)->nullable()->comment('本车车损');
            $table->decimal('three_car_damage', 10, 2)->nullable()->comment('三者车损');
            $table->decimal('injure_cost', 10, 2)->nullable()->comment('人伤费用');
            $table->decimal('insurance', 10, 2)->nullable()->comment('保险赔回');
            $table->decimal('total_cost', 10, 2)->nullable()->comment('花费总计金额');
            $table->decimal('balance_cost', 10, 2)->nullable()->comment('结余金额');
            $table->decimal('loss_cost', 10, 2)->nullable()->comment('亏损金额');
            $table->decimal('litigation_cost', 10, 2)->nullable()->comment('诉讼金额');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('akbus_accident');
    }
}
